package com.example;

public class Main {
    public static void main(String[] args) {
        System.out.println("欢迎使用Git版本控制系统！");
        System.out.println("这是初始版本提交。");

        displayWelcomeMessage();
    }

    public static void displayWelcomeMessage() {
        System.out.println("=================================");
        System.out.println("    Git实践项目 - 版本控制演示    ");
        System.out.println("=================================");
    }

    public static void main(String[] args) {
        System.out.println("欢迎使用Git版本控制系统！");
        System.out.println("这是第二个版本提交 - 添加计算器功能。");

        displayWelcomeMessage();
        demonstrateCalculator();
    }

    public static void demonstrateCalculator() {
        Calculator.displayFunctions();

        double a = 10.5;
        double b = 2.5;

        System.out.println("\n计算器功能测试:");
        System.out.println(a + " + " + b + " = " + Calculator.add(a, b));
        System.out.println(a + " - " + b + " = " + Calculator.subtract(a, b));
        System.out.println(a + " * " + b + " = " + Calculator.multiply(a, b));
        System.out.println(a + " / " + b + " = " + Calculator.divide(a, b));
    }

    public static void demonstrateStringUtils() {
        StringUtils.displayFunctions();

        String testStr1 = "Hello Git";
        String testStr2 = "A man a plan a canal Panama";

        System.out.println("\n字符串工具功能测试:");
        System.out.println("原始字符串: " + testStr1);
        System.out.println("反转结果: " + StringUtils.reverse(testStr1));
        System.out.println("单词数量: " + StringUtils.countWords(testStr1));

        System.out.println("\n测试回文检测:");
        System.out.println("测试字符串: " + testStr2);
        System.out.println("是否为回文: " + StringUtils.isPalindrome(testStr2));
    }
}